﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Drawing;

namespace HA.Data
{


    /// <summary>
    /// 用于表示显示选项中的颜色，与形状实体
    /// </summary>
    [Serializable]
   public class DOEntity:ICloneable
    {


        public DOEntity(Color color, DisplayShape shape)
        {
            this._color = color;

            this._displayShape = shape;


        }


        bool _enabled = true;

        public bool Enabled
        {
            get { return _enabled; }
            set { _enabled = value; }
        }


        Color _color=Color.Orange;

        public Color Color
        {
            get { return _color; }
            set { _color = value; }
        }

        int _size = 8;
        /// <summary>
        /// 大小
        /// </summary>
        public int Size
        {
            get { return _size; }
            set { _size = value; }
        }

        DisplayShape _displayShape=DisplayShape.Square;

        public DisplayShape DisplayShape
        {
            get { return _displayShape; }
            set { _displayShape = value; }
        }
        public object Clone()
        {
            return this.MemberwiseClone();
        }


        public static bool operator ==(DOEntity sp1, DOEntity sp2)
        {
            // check for both null (cast to object or recursive loop)
            if ((object)sp1 == null && (object)sp2 == null)
            {
                return true;
            }

            // check for either of them == to null
            if ((object)sp1 == null || (object)sp2 == null)
            {
                return false;
            }


            if (sp1._color.B != sp2.Color.B || sp1._color.G != sp2.Color.G || sp1._color.R != sp2.Color.R || sp1._color.A != sp2.Color.A || sp1.DisplayShape != sp2.DisplayShape || sp1.Size != sp2.Size || sp1.Enabled != sp2.Enabled)
            {
                return false;

            }

            else
            {
                return true;
            }

        }


        public static bool operator !=(DOEntity sp1, DOEntity sp2)
        {
            return !(sp1 == sp2);

        }

    }
}
